package com.design.pattern.createmode.prototype;

import com.design.pattern.createmode.builder.Computer;

/**
 * 创建型模式-原型模式
 * @author yll
 * @version 1.0.0
 * @date 2024/03/14 14：42
 * @desc Prototype 原型类
 * */
public class Prototype implements Cloneable {

    private String name;
    private Integer age;
    public Object clone(){
        try {
            return super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return null;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Prototype{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
